﻿@model List<DataAccess.Models.Withdraw>
@{
    ViewBag.Title = "Withdraw";
    Layout = null;
    var zfbmodel = new DataAccess.Models.Withdraw();
    var yhmodel = new DataAccess.Models.Withdraw();
}

 <!doctype html>
<html class="no-js">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no">
    <title>代理提现 - 合伙人系统</title>

    <link rel="stylesheet" type="text/css" href="//lib.baomitu.com/amazeui/2.7.2/css/amazeui.min.css" />
    <link rel="stylesheet" type="text/css" href="/css/style_hl.css?t=6" />

    <script type="text/javascript" src="//lib.baomitu.com/jquery/2.2.4/jquery.min.js"></script>
    <!--[if (gte IE 9)|!(IE)]><!-->
    <script type="text/javascript" src="//lib.baomitu.com/amazeui/2.7.2/js/amazeui.min.js"></script>

    <!--<![endif]-->
    <!-- <script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.0.0.js"></script> -->
    <!-- 微信自定义接口 -->
    <!-- <script>
        wx.config();
        wx.ready(function(){
                        wx.hideMenuItems({
                           menuList: ["menuItem:share:timeline"]
                        });
            wx.onMenuShareAppMessage({
                title: document.title,
                desc: "",
                link: window.location.href ,
                imgUrl: ""
            });
            wx.onMenuShareTimeline({
                title: document.title,
                desc: "",
                link: window.location.href,
                imgUrl: ""
            });
        });
    </script> -->
    <!-- 微信自定义接口 -->

</head>

<body>

    <div class="am-modal am-modal-alert" tabindex="-1" id="fq_alert">
        <div class="am-modal-dialog">
            <div class="am-modal-hd" id="fq_alert_title"></div>
            <div class="am-modal-bd" id="fq_alert_info">
            </div>
            <div class="am-modal-footer">
                <span class="am-modal-btn">确定</span>
            </div>
        </div>
    </div>

    <div class="am-modal am-modal-confirm" tabindex="-1" id="fq_confirm">
        <div class="am-modal-dialog">
            <div class="am-modal-hd" id="fq_confirm_title"></div>
            <div class="am-modal-bd" id="fq_confirm_info"></div>
            <div class="am-modal-footer">
                <span class="am-modal-btn" data-am-modal-confirm>确定</span>
            </div>
        </div>
    </div>

    <link rel="stylesheet" href="//at.alicdn.com/t/font_t17k322ba84zpvi.css" />
    <link rel="stylesheet" href="/css/hl_withdraw.css?t=1478719898" />
    <style>
        #cash_log tbody tr td {
            vertical-align: middle !important;
        }
    </style>
    <div style="margin-bottom:50px">
        <header class="fq-background-white">
            <a href="javascript:void(0);" onclick="back();" class="am-inline-block am-padding-left-sm am-icon-angle-left"></a>
            <div class="am-text-center am-padding-vertical-sm am-text-default">提现</div>
        </header>
        <div class="fq-withdraw fq-background-white am-padding-vertical-sm am-center am-text-center">
            <img class="fq-withdraw-gold am-center" src="/images/gold.png" />
            <div class="fq-withdraw-num">
                <sup class="am-text-sm">￥</sup>
                <span class="am-text-xl">@ViewBag.withdraw_count</span>
                <br />
                <span class="fq-withdraw-gray am-padding-horizontal am-text-sm">可提现金额</span>
            </div>
        </div>

        <div class="fq-background-white am-margin-top-sm">
            <!-- <div class="am-text-center am-center am-text-sm fq-default-text am-padding-top-sm">“当前默认提现方式：<span class="type_name">支付宝 </span>”</div> -->
            <div class="am-text-center am-center am-text-sm fq-default-text am-padding-top-sm now_type" style="display:none;">“当前默认提现方式：<span class="type_name">银行卡</span>”</div>
            <div class="fq-alipay">
             @{
                 zfbmodel=Model.Find(l=>l.type==1);
                 if (zfbmodel != null)
                 { 
                  <!--已绑定账号样式-->
                <div class="fq-default am-text-sm am-margin-horizontal-sm am-padding-vertical-sm">
                    <i class="icon-radio iconfont js_default js_alipay" data-id="1" style="color:#C9B174;font-size: 24px;line-height: 24px;"></i>
                    <span class="fq-radio-text alipay_type">支付宝提现</span>
                    <span class="fq-alipay-name am-text-sm alipay_exit">@zfbmodel.account_number</span>
                </div>
                 }
                 else
                 {
                     zfbmodel = new DataAccess.Models.Withdraw();
                    <!--未绑定账号样式-->
                <a class="am-margin-horizontal-sm am-padding-vertical-sm am-vertical-align am-block" style="height:48px; position:relative">
                    <span class="fq-alipay-text am-text-middle am-text-sm">支付宝</span>
                    <div class="am-fr am-vertical-align am-text-sm click_alipay_info">
                        <span class="fq-alipay-explain am-text-sm am-margin-right-xs">请添加支付宝账号</span>
                        <i class="am-icon-sm fq-alipay-icon am-icon-angle-right am-text-default"></i>

                    </div>
                </a>

                 }
                 
             }
                
                
               


                <!--支付宝绑定情况-->
                <div class="fq-alipay-message fq-background-white am-padding-horizontal-sm am-padding-vertical-sm">
                    <div class="fq-massage-num am-padding-horizontal-sm am-padding-vertical-xs">
                        <span class="fq-alipay-black am-text-middle am-text-sm am-inline-block">支付宝账号</span>
                        <div class="am-fr am-vertical-align am-text-sm">
                            <input class="am-text-sm am-text-right" id="alipay" value="@zfbmodel.account_number" type="text" placeholder="请输入支付宝账号" />
                        </div>
                    </div>

                    <div class="fq-massage-name am-margin-top-sm am-padding-horizontal-sm am-padding-vertical-xs">
                        <span class="fq-alipay-black am-text-middle am-text-sm am-inline-block">真实姓名</span>
                        <div class="am-fr am-vertical-align am-text-sm">
                            <input class="am-text-sm am-text-right" id="alipay_name" value="@zfbmodel.account_name" type="text" placeholder="请输入真实姓名" />
                        </div>
                    </div>

                    <div class="fq-withdraw-red am-text-sm am-margin-top-xs">【说明】支付宝以及姓名一经绑定将无法修改！</div>
                    <div class="am-center am-text-center am-margin-top-sm">
                        <button class="fq-withdraw-button fq-background-white am-round am-padding-vertical-sm alipay_bound">绑定支付宝</button>
                    </div>
                </div>
            </div>

            <!--银行卡绑定情况-->
            <!--已绑-->
            <div class="fq-card">
                @{
                yhmodel=Model.Find(l=>l.type==2);
                if (yhmodel != null)
                {   
                  
                <div class="fq-default am-text-sm am-margin-horizontal-sm am-padding-vertical-sm">
                        <i class="icon-radio iconfont js_default js_card" data-id="2" style="color:#C9B174;font-size: 24px;line-height: 24px;"></i>                 
                    <span class="fq-radio-text">银行卡提现 </span>
                    <span class="fq-card-name am-text-sm card_exit">@yhmodel.account_number</span>
                </div>
                }
                else
                { 
                    yhmodel=new DataAccess.Models.Withdraw();
                  <a class="am-margin-horizontal-sm am-padding-vertical-sm am-vertical-align am-block" style="height:48px; position:relative">
                    <span class="fq-bank-card am-text-middle am-text-sm">银行卡</span>
                    <div class="am-fr am-vertical-align am-text-sm">
                        <span class="fq-card-explain am-text-sm am-margin-right-xs">请添加银行卡信息</span>
                        <i class="am-icon-sm fq-card-icon am-icon-angle-right am-text-default"></i>
                    </div>
                </a>
                }    
                    
                }
                
                
                <!--未绑-->
                <!--银行卡绑定情况-->
                <div class="fq-card-message fq-background-white am-padding-horizontal-sm am-padding-vertical-sm">


                    <div class="fq-card-details am-margin-top-sm am-padding-horizontal-sm am-padding-vertical-xs">
                        <span class="fq-card-black am-text-middle am-text-sm am-inline-block">姓名</span>
                        <div class="am-fr am-vertical-align am-text-sm">
                            <input class="am-text-sm am-text-right" id="yourname" value="@yhmodel.account_name" type="text" placeholder="请输入真实姓名" />
                        </div>
                    </div>
                    <div class="fq-card-details am-padding-horizontal-sm am-padding-vertical-xs">
                        <span class="fq-card-black am-text-middle am-text-sm am-inline-block">卡号</span>
                        <div class="am-fr am-vertical-align am-text-sm">
                            <input class="am-text-sm am-text-right" id="cardnumber" value="@yhmodel.account_number" type="text" placeholder="请输入银行卡账号" />
                        </div>
                    </div>
                    <div class="fq-card-details am-margin-top-sm am-padding-horizontal-sm am-padding-vertical-xs">
                        <span class="fq-card-black am-text-middle am-text-sm am-inline-block">银行</span>
                        <div class="am-fr am-vertical-align am-text-sm">
                            <input class="am-text-sm am-text-right" id="card" type="text" value="@yhmodel.opening_bank" placeholder="请输入银行开户行名称" />
                        </div>
                    </div>

                    <div class="fq-withdraw-red am-text-sm am-margin-top-xs">【说明】银行卡，姓名以及银行名称一经绑定将无法修改！</div>
                    <div class="am-center am-text-center am-margin-top-sm">
                        <button class="fq-withdraw-button fq-background-white am-round am-padding-vertical-sm card_bound">绑定银行卡</button>
                    </div>
                </div>


            </div>
        </div>

        <div class="fq-free-withdraw fq-background-white am-margin-top-sm">
            <a class="am-margin-horizontal-sm am-padding-vertical-sm am-vertical-align am-block">
                <span class="fq-free-black am-text-middle am-text-sm am-inline-block">本次提现</span>
                <div class="am-fr am-vertical-align am-text-sm">
                    <input readonly class="am-text-sm am-text-right" type="text" id="withdraw_count" value="@ViewBag.withdraw_count" placeholder="请输入提现金额" />
                </div>
            </a>
            <div class="am-padding-horizontal-sm am-padding-bottom-sm">
                <div class="fq-alipay-explain am-text-sm am-margin-top-xs am-margin-bottom-lg">
                    【说明】</br>
                    1、2017-05-21 00:00:00开始系统会自动结算上个月的佣金到您的可用余额。</br>
                    2、您的提现将会在1-3个工作日内到账，请耐心等待！
                </div>
                <div class="am-center am-text-center am-margin-top-sm">
                    <button class="fq-withdraw-button fq-background-white am-btn am-round am-padding-vertical-sm withdraw" data-am-modal="{target: '#fq-withdraw-button'}">我要提现</button>
                </div>
            </div>

        </div>

        <div class="fq-withdraw-record fq-background-white am-margin-top-sm">
            <a class="am-margin-horizontal-sm am-padding-vertical-sm am-vertical-align am-block">
                <span class="fq-record-black am-text-middle am-text-sm am-inline-block">资金记录</span>
                <div class="am-fr am-vertical-align am-text-sm">
                    <i class="am-icon-sm fq-record-icon am-icon-angle-down am-text-default"></i>
                </div>
            </a>
        </div>

        <div class="fq-record-message fq-background-white">
            <table class="fq-background-white am-table am-table-striped am-text-sm am-text-center" id="cash_log">
                <thead>
                    <tr>
                        <th class="am-text-center">时间</th>
                        <th class="am-text-center">金额</th>
                        <th class="am-text-center">事件</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td class="am-text-center">123</td>
                        <td>123</td>
                        <td>123</td>

                    </tr>
                    <tr>
                        <td class="am-text-center">123</td>
                        <td>123</td>
                        <td>123</td>

                    </tr>

                </tbody>
            </table>
            <div class="am-text-center am-text-sm">暂无资金记录</div>            <ul class="am-pagination am-pagination-centered am-text-xs" id="page"></ul>

        </div>

    </div>

    <!--确认模态框开始-->
    <div class="am-modal am-modal-confirm" tabindex="-1" id="fq_confirms">
        <div class="am-modal-dialog">
            <div class="am-modal-hd" id="fq_confirm_title"></div>
            <div class="am-modal-bd" id="fq_confirm_infos"></div>
            <div class="am-modal-footer">
                <span class="am-modal-btn" data-am-modal-confirm>确定</span>
            </div>
        </div>
    </div>
    <!--确认模态框结束-->

    <div class="fq-withdraw-massage am-modal am-modal-confirm" tabindex="-1" id="alipay_edit">
        <div class="fq-background-white am-modal-dialog">
            <div class="am-modal-hd">
                支付宝绑定
            </div>
            <div class="am-modal-bd am-text-sm">
                <div class="am-cf">
                    <span class="am-fl">支付宝账号</span>
                    <span class="am-fr" id="alipay_text"></span>
                </div>

                <div class="am-cf">
                    <span class="am-fl">真实姓名</span>
                    <span class="am-fr" id="alipay_name_text"></span>
                </div>
            </div>
            <div class="am-modal-footer">
                <ul class="fq-withdraw-option am-avg-sm-2 am-margin-bottom">
                    <li>
                        <span class="am-modal-btn fq-option-cancel fq-background-white am-fr am-round am-padding-vertical-sm am-margin-right-sm"
                              data-am-modal-cancel>取消</span>
                    </li>
                    <li>
                        <span class="am-modal-btn fq-option-cancel fq-background-white am-fl am-round am-padding-vertical-sm am-margin-left-sm" data-am-modal-confirm>确认绑定</span>
                    </li>
                </ul>
            </div>
        </div>
    </div>

    <!--银行卡绑定二次确认-->
    <div class="fq-withdraw-massage am-modal am-modal-confirm" tabindex="-1" id="card_edit">
        <div class="fq-background-white am-modal-dialog">
            <div class="am-modal-hd">
                银行卡绑定
            </div>
            <div class="am-modal-bd am-text-sm">


                <div class="am-cf">
                    <span class="am-fl">姓名</span>
                    <span class="am-fr" id="truename"></span>
                </div>
                <div class="am-cf">
                    <span class="am-fl">卡号</span>
                    <span class="am-fr" id="bankcacd"></span>
                </div>
                <div class="am-cf">
                    <span class="am-fl">银行</span>
                    <span class="am-fr" id="bank"></span>
                </div>
            </div>
            <div class="am-modal-footer">
                <ul class="fq-withdraw-option am-avg-sm-2 am-margin-bottom">
                    <li>
                        <span class="am-modal-btn fq-option-cancel fq-background-white am-fr am-round am-padding-vertical-sm am-margin-right-sm"
                              data-am-modal-cancel>取消</span>
                    </li>
                    <li>
                        <span class="am-modal-btn fq-option-cancel fq-background-white am-fl am-round am-padding-vertical-sm am-margin-left-sm" data-am-modal-confirm>确认绑定</span>
                    </li>
                </ul>
            </div>
        </div>
    </div>

    <div class="fq-withdraw-massage am-modal am-modal-confirm" tabindex="-1" id="alipay_withdraw">
        <div class="fq-background-white am-modal-dialog">
            <div class="am-modal-hd">
                支付宝提现
            </div>
            <div class="am-modal-bd am-text-sm">
                <div class="am-cf">
                    <span class="am-fl">支付宝账号</span>
                    <span class="am-fr" id="alipay_withdraw_text"></span>
                </div>

                <div class="am-cf">
                    <span class="am-fl">提现金额</span>
                    <span class="am-fr" id="alipay_withdraw_count_text"></span>
                </div>
            </div>
            <div class="am-modal-footer">
                <ul class="fq-withdraw-option am-avg-sm-2 am-margin-bottom">
                    <li>
                        <span class="am-modal-btn fq-option-cancel fq-background-white am-fr am-round am-padding-vertical-sm am-margin-right-sm"
                              data-am-modal-cancel>取消</span>
                    </li>
                    <li>
                        <span class="am-modal-btn fq-option-cancel fq-background-white am-fl am-round am-padding-vertical-sm am-margin-left-sm" data-am-modal-confirm>确认提现</span>
                    </li>
                </ul>
            </div>
        </div>
    </div>

    <!--银行卡体现-->
    <div class="fq-withdraw-massage am-modal am-modal-confirm" tabindex="-1" id="card_withdraw">
        <div class="fq-background-white am-modal-dialog">
            <div class="am-modal-hd">
                银行卡提现
            </div>
            <div class="am-modal-bd am-text-sm">
                <div class="am-cf">
                    <span class="am-fl">卡号</span>
                    <span class="am-fr" id="card_withdraw_text"></span>
                </div>

                <div class="am-cf">
                    <span class="am-fl">提现金额</span>
                    <span class="am-fr" id="card_withdraw_count_text"></span>
                </div>
            </div>
            <div class="am-modal-footer">
                <ul class="fq-withdraw-option am-avg-sm-2 am-margin-bottom">
                    <li>
                        <span class="am-modal-btn fq-option-cancel fq-background-white am-fr am-round am-padding-vertical-sm am-margin-right-sm"
                              data-am-modal-cancel>取消</span>
                    </li>
                    <li>
                        <span class="am-modal-btn fq-option-cancel fq-background-white am-fl am-round am-padding-vertical-sm am-margin-left-sm" data-am-modal-confirm>确认提现</span>
                    </li>
                </ul>
            </div>
        </div>
    </div>
    <input type="hidden" class="wd_type" value="@ViewBag.withdraw_type">

    <div class="am-modal am-modal-alert" tabindex="-1" id="fq_alert_msg">
        <div class="am-modal-dialog">
            <div class="am-modal-hd" id="fq_alert_msg_title"></div>
            <div class="am-modal-bd am-text-sm" id="fq_alert_msg_info">
                <span>交易号：</span><br><span id="trade"></span>
            </div>
            <div class="am-modal-footer">
                <span class="am-modal-btn" data-am-modal-confirm>确定</span>
            </div>
        </div>
    </div>

    <div class="am-modal am-modal-alert" tabindex="-1" id="fq_alert_refuse_msg">
        <div class="am-modal-dialog">
            <div class="am-modal-hd"></div>
            <div class="am-modal-bd am-text-sm">
                <span>拒绝原因：</span><br><span id="reason"></span>
            </div>
            <div class="am-modal-footer">
                <span class="am-modal-btn" data-am-modal-confirm>确定</span>
            </div>
        </div>
    </div>


    <div class="menu">
        <ul class="am-avg-sm-3 am-text-center am-padding-top-xs">
            <li class="am-vertical-align">
                <a href="/index/index.html">
                    <img src="/Public/assets/mobile/images/personal/home-page-unact.png" class="am-text-center am-vertical-align-middle" />
                    <br />
                    <span class=" am-text-center am-vertical-align-middle">首页</span>
                </a>
            </li>
            <li class="am-vertical-align">
                <a href="/share/index.html">
                    <img src="/Public/assets/mobile/images/personal/Inordertoshare-unact.png" class="am-text-center am-vertical-align-middle" />
                    <br />
                    <span class=" am-text-center am-vertical-align-middle">晒单广场</span>
                </a>
            </li>
            <li class="am-vertical-align">
                <a href="/user/index.html">
                    <img src="/Public/assets/mobile/images/personal/per-center-unact.png" class="am-text-center am-vertical-align-middle" />
                    <br />
                    <span class=" am-text-center am-vertical-align-middle">个人中心</span>
                </a>
            </li>
        </ul>
    </div>
    <style>
        .main {
            bottom: 40px;
        }
    </style>

    <style>
        .menu {
            width: 100%;
            position: absolute;
            position: fixed;
            bottom: 0;
            background: #fff;
            border-top: .1rem solid #F3E7E3;
            z-index: 999;
        }

            .menu img {
                width: 1.5rem;
                height: 1.5rem;
                margin-bottom: .2rem;
            }

            .menu a {
                display: inline-block;
                color: #3d0505;
            }

                .menu a span {
                    font-size: 1.2rem;
                }
    </style>

    <script>
        function fq_alert(info) {
            $('#fq_alert_info').text(info);
            $('#fq_alert').modal();
        }

        $(function () {
            $('.js_default').removeClass('icon-icon2').addClass('icon-radio');
            var withdraw_type = "@(ViewBag.withdraw_type)";
            if (withdraw_type == 1) {
                $('.js_alipay').removeClass('icon-radio').addClass('icon-icon2');
            } else {
                $('.js_card').removeClass('icon-radio').addClass('icon-icon2');
            }
            $('.js_default').click(function () {
                $('.js_default').removeClass('icon-icon2').addClass('icon-radio');
                $(this).removeClass('icon-radio').addClass('icon-icon2');
                $('.wd_type').val($(this).attr('data-id'));
                if ($(this).attr('data-id') == 1) {
                    $('.type_name').text('支付宝');
                } else if($(this).attr('data-id') == 2 ){
                    $('.type_name').text('银行卡');
                }
            })
        })



        $(document).ready(function () {
            $('.js_refuse').click(function () {
                var reason = $(this).attr('data-reason') || '请自行联系商家';
                $('#reason').text(reason);
                $('#fq_alert_refuse_msg').modal();
            })
            $('.js_pass').click(function () {
                $('#trade').text($(this).attr('data-trade'))
                $('#fq_alert_msg').modal();
            })
            //绑定支付宝账号显影

            if ("" == "") {
                $(".fq-alipay a").click(function () {
                    $(".fq-alipay-message").slideToggle("slow", function () {
                        if ($(".fq-alipay-message").is(":hidden")) {
                            $(".fq-alipay-text").removeClass('fq-move');
                            $(".fq-alipay-explain").css('display', 'inline-block');
                            $(".fq-alipay-icon").removeClass('am-icon-angle-down').addClass('am-icon-angle-right');
                            $(".fq-alipay a").css('border-bottom', 'none');
                        } else {
                            $(".fq-alipay-text").addClass('fq-move');
                            $(".fq-alipay-explain").css('display', 'none');
                            $(".fq-alipay a").css('border-bottom', '1px solid #F2EFED');
                            $(".fq-alipay-icon").removeClass('am-icon-angle-right').addClass('am-icon-angle-down');

                        }

                    });
                });
            }

            $(".fq-card a").click(function () {
                $(".fq-card-message").slideToggle("slow", function () {
                    if ($(".fq-card-message").is(":hidden")) {
                        $(".fq-bank-card").removeClass('fq-move');
                        $(".fq-card-explain").css('display', 'inline-block');
                        $(".fq-card-icon").removeClass('am-icon-angle-down').addClass('am-icon-angle-right');
                        $(".fq-card a").css('border-bottom', 'none');
                    } else {
                        $(".fq-bank-card").addClass('fq-move');
                        $(".fq-card-explain").css('display', 'none');
                        $(".fq-card a").css({ 'border-bottom': '1px solid #F2EFED', 'position': 'relative' });
                        $(".fq-card-icon").removeClass('am-icon-angle-right').addClass('am-icon-angle-down');

                    }

                });
            });




            //转账记录显影

            $(".fq-withdraw-record").click(function () {
                $(".fq-record-message").slideToggle("slow", function () {
                    if ($(".fq-record-message").is(":hidden")) {
                        $(".fq-record-icon").removeClass('am-icon-angle-down').addClass('am-icon-angle-right');
                        $(".fq-withdraw-record a").css('border-bottom', 'none');
                    } else {
                        $(".fq-record-icon").removeClass('am-icon-angle-right').addClass('am-icon-angle-down');
                        $(".fq-withdraw-record a").css('border-bottom', '1px solid #F2EFED');
                    }

                });
            });

            var value = $('#withdraw_count').val();
            var cash = parseFloat('@(ViewBag.withdraw_count)');
            $('#withdraw_count').on('input', function () {
                var str = $(this).val();
                if (str != '') {
                    if (str.match(/^(\d{1,})$/) == null && str.match(/^^(\d{0,}\.\d{0,2})$/) == null) {
                        $(this).val(value);
                    } else if (parseFloat(('0' + str)) > cash) {
                        $(this).val(cash);
                        value = cash;
                    } else {
                        value = str;
                    }
                } else {
                    value = str;
                }
            });

        });

        function back() {
            window.history.back();
        }

        //支付宝绑定
        $('.alipay_bound').click(function () {
            var ID = $('#alipay').val();
            var ID_name = $('#alipay_name').val();
            if (ID == "") {
                $('#fq_alert_info').text('支付宝账号不能为空');
                $('#fq_alert').modal();
                return false;
            }
            if (ID_name == "") {
                $('#fq_alert_info').text('真实姓名不能为空');
                $('#fq_alert').modal();
                return false;
            }
            $('#alipay_text').text($('#alipay').val());
            $('#alipay_name_text').text($('#alipay_name').val())
            $('#alipay_edit').modal({
                relatedTarget: this,
                onConfirm: function () {
                    var alipay = $('#alipay_text').text();
                    var alipay_name = $('#alipay_name_text').text();

                    $.ajax({
                        type: 'post',
                        url: "/agent/PostWithdraw",
                        data: { type: 1, 'account_number': alipay, 'account_name': alipay_name },
                        success: function (data) {
                            if (data.State) {
                                $("#fq_confirm_infos").text(data.Message);
                                $('#fq_confirms').modal({
                                    closeViaDimmer: false,
                                    relatedTarget: this,
                                    onConfirm: function (options) {
                                        window.location.reload();
                                    }
                                });

                            } else {
                                $("#fq_alert_info").text(data.Message);
                                $('#fq_alert').modal();

                            }
                        }
                    });
                }
            })
        })

        //银行卡绑定
        $('.card_bound').click(function () {
            var yourname = $('#yourname').val();
            var cardnumber = $('#cardnumber').val();
            var card = $('#card').val();
            $('#truename').text($('#yourname').val());
            $('#bankcacd').text($('#cardnumber').val());
            $('#bank').text($('#card').val());
            $('#card_edit').modal({
                relatedTarget: this,
                onConfirm: function () {
                    var truename = $('#truename').text();
                    var bankcacd = $('#bankcacd').text();
                    var bank = $('#bank').text();

                    $.ajax({
                        type: 'post',
                        url: "/agent/PostWithdraw",
                        data: { type: 2, 'account_name': truename, 'account_number': bankcacd, 'opening_bank': bank },
                        success: function (data) {
                            if (data.State) {
                                $("#fq_confirm_infos").text(data.Message);
                                $('#fq_confirms').modal({
                                    closeViaDimmer: false,
                                    relatedTarget: this,
                                    onConfirm: function (options) {
                                        window.location.reload();
                                    }
                                });

                            } else {
                                $("#fq_alert_info").text(data.Message);
                                $('#fq_alert').modal();

                            }
                        }
                    });
                }
            })
        })





        $('.withdraw').click(function () {
            var withdraw_count = $('#withdraw_count').val();
            var sum = "0.00";
            var change_type = $('.wd_type').val();
            if (change_type) {
                var wd_type = change_type;
            } else {
                var wd_type = '@(ViewBag.withdraw_type)';
            }
            if(wd_type==0)
            {
                $('#fq_alert_info').text('请填写信息');
                $('#fq_alert').modal();
                return false;
            }

            if (wd_type == 1) {
               
                if (withdraw_count == "") {
                    $('#fq_alert_info').text('提现金额不能为空');
                    $('#fq_alert').modal();
                    return false;
                }
                var cash = parseFloat(('0' + $('#withdraw_count').val())).toFixed(2);
                if (cash == 0) {
                    $('#fq_alert_info').text('提现金额不能为零');
                    $('#fq_alert').modal();
                    return false;
                }
                $('#alipay_withdraw_text').text($('.alipay_exit').text());
                $('#alipay_withdraw_count_text').text(cash);

                $('#alipay_withdraw').modal({
                    relatedTarget: this,
                    onConfirm: function () {

                        var count = $('#withdraw_count').val();

                        $.ajax({
                            type: 'post',
                            url: "/agent/PostWithdrawApply",
                            data: {'wd_type': '1' },
                            success: function (data) {
                                if (data.State == true) {
                                    $("#fq_confirm_infos").text(data.Message);
                                    $('#fq_confirms').modal({
                                        closeViaDimmer: false,
                                        relatedTarget: this,
                                        onConfirm: function (options) {
                                            window.location.reload();
                                        }
                                    });

                                } else {
                                    $("#fq_alert_info").text(data.Message);
                                    $('#fq_alert').modal();
                                }
                            }
                        });
                    }
                })
            } else {
                //var truename = $('#truename').val();
                //var bankcard = $('#bankcard').val();
                //var bank = $('#bank').val();

                //if (truename == "") {
                //    $('#fq_alert_info').text('真实姓名不能为空');
                //    $('#fq_alert').modal();
                //    return false;
                //}
                //if (bank == "") {
                //    $('#fq_alert_info').text('所属银行不能为空');
                //    $('#fq_alert').modal();
                //    return false;
                //}
                //if (bankcard == "") {
                //    $('#fq_alert_info').text('银行卡号不能为空');
                //    $('#fq_alert').modal();
                //    return false;
                //}
                var cash = parseFloat(('0' + $('#withdraw_count').val())).toFixed(2);
                if (cash == 0) {
                    $('#fq_alert_info').text('提现金额不能为零');
                    $('#fq_alert').modal();
                    return false;
                }
                $('#card_withdraw_text').text($('.card_exit').text());
                $('#card_withdraw_count_text').text(cash);

                $('#card_withdraw').modal({
                    relatedTarget: this,
                    onConfirm: function () {

                        var count = $('#withdraw_count').val();

                        $.ajax({
                            type: 'post',
                            url: "/agent/PostWithdrawApply",
                            data: {  'wd_type': '2' },
                            success: function (data) {
                                if (data.State == true) {
                                    $("#fq_confirm_infos").text(data.Message);
                                    $('#fq_confirms').modal({
                                        closeViaDimmer: false,
                                        relatedTarget: this,
                                        onConfirm: function (options) {
                                            window.location.reload();
                                        }
                                    });

                                } else {
                                    $("#fq_alert_info").text(data.Message);
                                    $('#fq_alert').modal();
                                }
                            }
                        });
                    }
                })
            }



        })

    </script>
